home *** CD-ROM | disk | FTP | other *** search
- static const char rcs_id[] = "$Header: /disk1/schutte/src_tree/cppima/examples/RCS/localmax.cc,v 1.2 1994/06/07 15:20:16 schutte Exp schutte $";
- // cppima: a C++ image processing library
-
- // Copyright (C) 1992 Klamer Schutte
-
- // klamer@mi.el.utwente.nl
-
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Library General Public
- // License as published by the Free Software Foundation; either
- // version 2 of the License, or (at your option) any later version.
-
- // This library is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- // Library General Public License for more details.
-
- // You should have received a copy of the GNU Library General Public
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
- // $Log: localmax.cc,v $
- // Revision 1.2 1994/06/07 15:20:16 schutte
- // Changed from VIFF to IMA.
- //
- // Revision 1.1 1992/09/25 15:35:30 klamer
- // Initial revision
- //
-
- // Calculate the maximum value in my environment
- // Could be faster if x and y direction are separated.
-
- #include <cppima/imageiter.h>
- #include <cppima/enviter.h>
- #include <cppima/charimaimage.h>
- #include <cppima/charborderimage.h>
-
- inline int
- Max( int a, int b )
- {
- return (a>b) ? a : b;
- }
-
- main(int , char *argv[])
- {
- // Should check arguments
-
- CharImaImage src_image(argv[1]);
- CharBorderImage borderimage(src_image);
- CharImaImage dst_image(borderimage);
-
- EnvImageIter eii(borderimage);
- ImageWIter dst(eii,dst_image);
-
- while(eii())
- {
- EnvIter ei(eii);
-
- for(int max = eii.readint();ei(); /* empty */)
- max = Max(max,ei.readint());
-
- dst.writeint(max);
- }
- dst_image.writefile(argv[2]);
- }
-